package com.sk.bilibili.adapter.pager.channel;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

import com.sk.bilibili.adapter.pager.BaseTypeFragmentAdapter;
import com.sk.bilibili.bean.Type;
import com.sk.bilibili.view.fragment.channel.ThemFragment;
import com.sk.bilibili.view.fragment.channel.FullVideoSetFragment;

import java.util.List;

public class ChannelFragmentAdapter extends BaseTypeFragmentAdapter {

    public ChannelFragmentAdapter(@NonNull FragmentManager fm, List<Type> types) {
        super(fm, types);
    }

    @Override
    protected Fragment[] getFragments() {
        Fragment[] fragments=new Fragment[types.size()];
        for (int i = 0; i < fragments.length; i++) {
            Type type = types.get(i);
            if(type.getThemType()){
                fragments[i]=new ThemFragment(type.getId());
            }else {
                fragments[i]=new FullVideoSetFragment(type.getId(),i);
            }
        }
        return fragments;
    }

}